/**
 * BaseResponse.java
 *
 * @author liujie11
 * 
 * @date 2014-3-19
 * 
 * Copyright 2014 Baidu. All rights reserved. 
 */
package com.japher.hackson.response;

import com.baidu.common.utils.Tools;

/**
 * Base class of all responses, maintain response status
 * 
 * and status info
 */
public class BaseResponse {
    
    final public static int ERR_CODE_NET = -1;
    final public static int ERR_CODE_USER_CANCEL = -2;
    final public static int ERR_CODE_JSON_PARSE = -3;
    final public static int ERR_CODE_GEO_PARSE = -4;
    final public static int ERR_CODE_SERVER = -5;
    final public static int RET_CODE_SUCCESS = 0;
    final public static int ERR_CODE_TOKEN_TIME_OUT = 173;
    
    final public static String ERR_TEXT_JSON_PARSE = "解析数据失败";
    
    private int status = ERR_CODE_NET;
    private long size = 0;
    protected String statusMessage = "";
    private Exception exception;
    
    public Exception getException() {
        return exception;
    }
    
    public void setException(Exception exception) {
        this.exception = exception;
    }
    
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }


    public String getStatusMessage() {
        return statusMessage;
    }

    public void setStatusMessage(String statusMessage) {
        this.statusMessage = statusMessage;
    }

    public boolean isSuccess() {
        if (status == 0)
            return true;
        else
            return false;
    }
    
    public void setSize(long size) {
        this.size = size;
    }
    
    public long getSize() {
        return size;
    }
}
